package com.study.selection.service;

import com.study.selection.dao.CollegeDao;
import com.study.selection.dao.CourseDao;
import com.study.selection.model.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService {

    @Autowired
    private CourseDao courseDao;

    @Override
    public List<Course> findAll() {
        return courseDao.findAll();
    }

    @Override
    public List<Course> findByKey(String key) {
        return courseDao.findByKey(key);
    }

    @Override
    public boolean addCourse(Course course) {
        return courseDao.addCourse(course) > 0 ? true : false;
    }

    @Override
    public Course getByCourseId(int courseId) {
        return courseDao.getByCourseId(courseId);
    }

    @Override
    public List<Course> getByTeacherId(int teacherId){
        return courseDao.getByTeacherId(teacherId);
    }
    @Override
    public boolean updateCourse(Course course) {
        return courseDao.updateCourse(course) > 0 ? true : false;
    }
    @Override
    public boolean deleteCourse(int collegeId) {
        return courseDao.deleteCourse(collegeId) > 0 ? true : false;
    }


}